/***************************************************************************
 *   Copyright (C) 2009 by Marian Skvarek   *
 *   skvarek.marian@gmail.com   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef EASYSCORECEASYSCOREAPP_H
#define EASYSCORECEASYSCOREAPP_H

#include "CScore.h"
#include "CGlobals.h"
#include "CEasyScoreMainWindow.h"

#include <QFile>
#include <QString>

using namespace easyscore::core;

namespace easyscore
{

        class CEasyScoreMainWindow;
	
	/**
		Top level application's class managing whole application
		@author Marian Skvarek <skvarek.marian@gmail.com>
	*/
	class CEasyScoreApp
	{
//Members
		private:
                        CScore *mScore;
                        QString mCurrentFile;
			NOTE_VALUE mCurrentNoteValue;
			
                        CEasyScoreMainWindow *mGUI;
			
//Accessors
		public:
                        easyscore::core::CScore *getScore() { return mScore; }
                        void setCurrentFile(QString value) { mCurrentFile = value; }
                        QString getCurrentFile() { return mCurrentFile; }
			void setCurrentNoteValue(NOTE_VALUE value) { mCurrentNoteValue = value; }
			NOTE_VALUE getCurrentNoteValue() const { return mCurrentNoteValue; }
			
			CEasyScoreMainWindow *getGUI() const { return mGUI; }
			
		public:
			CEasyScoreApp();
			void initialize();
			
			void clear();
			~CEasyScoreApp();
			
//Public methods
		public:
                        bool newScore();
                        bool save(QFile &file);
                        bool load(QFile &file);
                        bool exportToPDF(QFile &file);
                        bool exportMIDI(QFile &file);
                        bool exportImage(QString dir);
                        bool exportTab(QFile &file);
                        bool exportMusicXML(QFile &file);
                        bool print();
                        void addBar();

			bool hasGUI() { return getGUI() != 0; }
			void createAndShowGUI();
			void destroyGUI();

//Protected methods
                    protected:
                        void setScore(CScore *score);
                        CScore *createScore();
	};
}//namespace easyscore

#endif
